// Property.h

#ifndef __PROPERTY_H
#define __PROPERTY_H


namespace Common
{
namespace Props
{
	//For details look at HandlerOut.cpp 
	static LPCTSTR ENCRYPTION_METHOD		= _T("em");
	static LPCTSTR FILTER_METHOD			= _T("f");
	static LPCTSTR COMPRESS_HEADER			= _T("hc");
	static LPCTSTR COMPRESS_HEADER_FULL		= _T("hcf");
	static LPCTSTR ENCRYPT_HEADER			= _T("he");
	static LPCTSTR BLOCK_SIZE				= _T("s");	

	static LPCTSTR _7Z_METHOD				= _T("0");
	static LPCTSTR OTHER_METHOD				= _T("m");

	static LPCTSTR BASED_ON_DICTIONARY_SIZE	= _T("d");
	static LPCTSTR BASED_ON_MEMORY_USED_SIZE= _T("mem");
	static LPCTSTR BASED_ON_BLOCK_SIZE		= _T("c");

	static LPCTSTR METHOD_ORDERED			= _T("o");	
	static LPCTSTR METHOD_CONTEXT_BITS		= _T("lc");

	static LPCTSTR METHOD_NUMB_PASSES		= _T("pass");
	static LPCTSTR METHOD_FAST_BYTES		= _T("fb");
	static LPCTSTR METHOD_MATCH_FINDER_CYCLES = _T("mc");
	static LPCTSTR METHOD_ALGORYTHM			= _T("a");
	static LPCTSTR METHOD_MATCH_FINDER		= _T("mf");
	static LPCTSTR THREAD_NUMBER			= _T("mt");

	static LPCTSTR EXEC_LEVEL				= _T("x");

	static LPCTSTR BOOL_TRUE				= _T("on");
	static LPCTSTR BOOL_FALSE				= _T("off");

	static LPCTSTR OPTION_SFX				= _T("rsfx");

struct CProperty
{
	
  CString Name;
  CString Value;

  CProperty()
  {
  }

  CProperty(LPCTSTR name, LPCTSTR value)
  {
	  this->Name = name;
	  this->Value = value;
  }

  CProperty(LPCTSTR parseString)
  {
	  CString result(parseString);
	  int nIndex = result.Find(_T("="));
	  if (0 > nIndex)
        this->Name = result;
      else
      {
        this->Name = result.Left(nIndex);
        this->Value = result.Mid(nIndex + 1);
      }	  
  }

  CProperty(LPCTSTR name, UINT32 value)
  {
	  this->Name = name;
	  TCHAR tmp[32];
	  _ui64tot(value, tmp, 10);
	  this->Value = tmp;
  }

  CProperty(LPCTSTR name, bool value)
  {
	  this->Name = name;
	  this->Value = (value ? BOOL_TRUE: BOOL_FALSE);
  }

  CProperty(const CProperty & obj) :
	  Name(obj.Name),
	  Value(obj.Value)
  {
  }

  CProperty & operator=(const CProperty & obj)
  {
	  Name  = obj.Name;
	  Value = obj.Value;
	  return *this;
  }
};


}
}
#endif
